package com.example.controller;

import com.example.msg.PageBean;
import com.example.msg.Result;
import com.example.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("/list")
    public PageBean select(@RequestParam(value = "page") Integer page, @RequestParam(value = "pageSize") Integer pageSize) {
        return userService.list(page, pageSize);
    }

    @DeleteMapping("/delete/{id}")
    public Result delete(Integer id) throws Exception {

        return userService.deleteById(id);
    }
}
